package retail.bo.impl;

import java.util.List;

import HibernateBeans.CustomerDetails;
import HibernateBeans.Customer_Products;
import HibernateBeans.Invoice;
import HibernateBeans.ProductDetails;
import HibernateBeans.RepDetails;
import HibernateBeans.Users;
import retail.bo.CustomerBo;
import retail.dao.CustomerDao;

public class CustomerBoImpl implements CustomerBo {

	CustomerDao customerDao;

	public void setCustomerDao(CustomerDao customerDao) {
		this.customerDao = customerDao;
	}

	@Override
	public boolean addCustomer(CustomerDetails customer) {
		return customerDao.addCustomer(customer);
	}

	@Override
	public List<CustomerDetails> findAllCustomer() {

		return customerDao.findAllCustomer();
	}

	@Override
	public CustomerDetails getCustomer(String username) {
		return customerDao.getCustomer(username);
	}
	
	@Override
	public List<ProductDetails> getProducts(String username) {
		return customerDao.getProducts(username);
	}

	@Override
	public List<ProductDetails> getAllProducts() {
		return customerDao.getAllProducts();
	}

	@Override
	public List<ProductDetails> getUpgrades(String pid) {
		
		return customerDao.getUpgrades(customerDao.getProduct(pid));
	}

	@Override
	public boolean upgrade(String username, String pid) {
		return customerDao.upgrade(username, customerDao.getProduct(pid));
	}

	@Override
	public ProductDetails getProduct(String pid) {
		return customerDao.getProduct(pid);
	}	
	@Override
	public Invoice getCurrentInvoice(String username) {
		return customerDao.getCurrentInvoice(username);
	}
	@Override
	public boolean payBill(Invoice invoice, double amount) {
		return customerDao.payBills(invoice, amount);
	}
	@Override
	public boolean registerUser(String userID, Users user) {
		return false;
	}

	@Override
	public CustomerDetails getUser(String uid) {
		return customerDao.getUser(uid);
	}

	@Override
	public boolean resetPassword(Users user) {
		return customerDao.resetPassword(user);
	}

	@Override
	public boolean removeProduct(String username, String pid) {
		return customerDao.removeProduct(username, pid);
	}

	@Override
	public int countUser(String username,String userid){
		return customerDao.countUser(username,userid);
	}
	@Override
	public boolean addCustomerProduct(Customer_Products customerProducts) {
		return customerDao.addCustomerProduct(customerProducts);
	}

	public String getSecurityQuestion(String username){
		return customerDao.getSecurityQuestion(username);
	}
	
	public boolean checkSecurityAnswer(String uid,String answer,String fname, String lname,String password){
		return customerDao.checkSecurityAnswer(uid,answer,fname,lname,password);
	}
	public boolean checkDetailsRep(String uid,String fname,String lname, String email,String password){
		return customerDao.checkDetailsRep(uid, fname, lname, email, password);
	}
	@Override
	public RepDetails getRepDetails(String userID) {
		return customerDao.getRepDetails(userID);
	}

	@Override
	public boolean addUser(Users user, String role) {
		return customerDao.addUser(user, role);
	}

	@Override
	public boolean updateCustomer(CustomerDetails customerDetails) {
		return customerDao.updateCustomer(customerDetails);
	}

	@Override
	public boolean updateRep(RepDetails repDetails) {
		return customerDao.updateRep(repDetails);
	}
}
